using System;
using System.Configuration;
using System.Runtime.InteropServices;

namespace Antu.Core.DataAccess
{
    /// <summary>
    /// 联接串
    /// </summary>
    [StructLayout(LayoutKind.Sequential, Size = 1)]
    public struct ConnectionText
    {
        private static string sqlText;
        private static string oracleText;
        private static string accessText;
        /// <summary>
        /// OleDb的联接串
        /// </summary>
        public static string AccessText
        {
            get
            {
                string tmpText = ConfigurationManager.AppSettings["AccessConnectionString"];
                if (!string.IsNullOrEmpty(tmpText))
                {
                    accessText = tmpText;
                }
                return accessText;
            }
            set
            {
                accessText = value;
            }
        }
        /// <summary>
        /// SqlServer的联接串
        /// </summary>
        public static string SqlText
        {
            get
            {
                string tmpText = ConfigurationManager.AppSettings["SqlConnectionString"];
                if (!string.IsNullOrEmpty(tmpText))
                {
                    sqlText = tmpText;
                }
                return sqlText;
            }
            set
            {
                sqlText = value;
            }
        }
        /// <summary>
        /// Oracle的联接串
        /// </summary>
        public static string OracleText
        {
            get
            {
                string tmpText = ConfigurationManager.AppSettings["OracleConnectionString"];
                if (!string.IsNullOrEmpty(tmpText))
                {
                    oracleText = tmpText;
                }
                return oracleText;
            }
            set
            {
                oracleText = value;
            }
        }
        static ConnectionText()
        {
            sqlText = "";
            oracleText = "";
            accessText = "";
        }
    }
}

